const crypto = require('crypto');
const jwt = require('jsonwebtoken')
let secretKey='luffy_1993711_26_jwttoken'

module.exports = {
  MD5_SUFFIX: '805696667',
  md5: (pwd) => {
    let md5 = crypto.createHash('md5');
    return md5.update(pwd).digest('hex');
  },
  secretKey:secretKey,
  algorithms:{
    algorithms:['HS256']
  },
  setToken:function(data){
    let tokenObj={   //携带参数
      id: 1,
      username: data
  }
  let tokenKey = secretKey  //加密内容

  let token = jwt.sign(tokenObj,tokenKey,{
      expiresIn: 60*60*24   // token时长
  })

  process.env.token=token

  return token
  }
};